<template>
    <div>
        <!-- From Uiverse.io by Awadhesh684827 -->
        <a class="btn-glitch-fill">
            <span class="text">// {{props.title}}</span><span class="text-decoration"> _</span><span
                class="decoration">⇒</span>
        </a>
    </div>
</template>
<script setup lang="ts">
    const props = defineProps({
    title: {
        type: String,
        default: "",
    },
})
</script>
<style scoped lang="scss">
/* From Uiverse.io by Awadhesh684827 */
[class*="btn-glitch-"] {
    display: inline-block;
    font-family: "VT323", monospace;
    border: 1px solid rgb(0, 0, 0);
    color: rgb(0, 0, 0);
    padding: 10px 13px;
    max-width: 175px;
    line-height: 1.5em;
    white-space: no-wrap;
    text-transform: uppercase;
    cursor: pointer;

    .text,
    .decoration {
        display: inline-block;
    }

    .decoration {
        display: inline-block;
    }

    &:hover,
    &:focus {
        animation-name: glitch;
        animation-duration: 0.2s;
        background-color: yellow;
        color: black;
        border: 1px solid yellow;

        .text-decoration {
            animation-name: blink;
            animation-duration: 0.1s;
            animation-iteration-count: infinite;
        }

        .decoration {
            animation-name: blink;
            animation-duration: 0.1s;
            animation-iteration-count: infinite;
        }
    }

    &:active {
        background: none;
        color: yellow;

        .text-decoration {
            animation-name: none;
        }

        .decoration {
            animation-name: none;
        }

        :before,
        :after {
            display: none;
        }
    }
}

@keyframes glitch {
    25% {
        background-color: red;
        transform: translateX(-10px);
        letter-spacing: 10px;
    }

    35% {
        background-color: green;
        transform: translate(10px);
    }

    59% {
        opacity: 0;
    }

    60% {
        background-color: blue;
        transform: translate(-10px);
        filter: blur(5px);
    }

    100% {
        background-color: yellow;
        blur: (5px);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes shrink {
    100% {
        width: 10%;
    }
}
</style>